package com.example.demo.service;

import com.example.demo.entity.AdminLog;
import com.example.demo.mapper.AdminLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminLogImpl implements AdminLogService {

    @Autowired
    private AdminLogMapper adminLogMapper;

    @Override
    public List<AdminLog> findAll() {
        return adminLogMapper.findAll();
    }

    @Autowired  // 自动注入
    public AdminLogImpl(AdminLogMapper adminLogMapper) {
        this.adminLogMapper = adminLogMapper;
    }

    @Override
    public Integer insert(AdminLog adminLog) {
        return adminLogMapper.addAdminLoginLogs(adminLog);
    }

    @Override
    public AdminLog findByAdminLogId(Integer logId){
        return adminLogMapper.findByAdminLogId(logId);
    } //根据登录日志id查询

    @Override
    public List<AdminLog> findByAdminId(Integer admin_id) {
        return adminLogMapper.findByAdminId(admin_id);
    }
}